package com.cookizz.waterfalldemo;

import java.util.ArrayList;
import java.util.List;

public class ImagePageIterator {

	// 当前url下标
	public static int index = 0;
	// 单位加载图片数量
	public static final int PAGE_SIZE = 16;
	// 图片url集合
	public static String[] imageUrls = new String[] {
			"http://img3.imgtn.bdimg.com/it/u=1975534038,2553914143&fm=21&gp=0.jpg",
			"http://life.chinaunix.net/bbsfile/forum/month_0602/pimpwall_nCYn5TIvE6o7.png",
			"http://img2.imgtn.bdimg.com/it/u=3533871350,3204431662&fm=21&gp=0.jpg",
			"http://img4.imgtn.bdimg.com/it/u=1102369843,2545563867&fm=21&gp=0.jpg",
			"http://c.hiphotos.baidu.com/image/pic/item/63d9f2d3572c11dfab19ae22612762d0f603c2e2.jpg",
			"http://a.hiphotos.baidu.com/image/w%3D230/sign=b1a0100f6509c93d07f209f4af3cf8bb/0eb30f2442a7d933b022be72af4bd11373f0012c.jpg",
			"http://d.hiphotos.baidu.com/image/pic/item/4e4a20a4462309f7cb944765700e0cf3d6cad6ca.jpg",
			"http://b.hiphotos.baidu.com/image/w%3D230/sign=b76f7cc69352982205333ec0e7ca7b3b/b17eca8065380cd7606fe2eca244ad34598281ba.jpg",
			"http://c.hiphotos.baidu.com/image/w%3D230/sign=44a3251daeaf2eddd4f14eeabd110102/ca1349540923dd5464e4fc73d309b3de9c824811.jpg",
			"http://f.hiphotos.baidu.com/image/w%3D230/sign=350ac9feae4bd11304cdb0316aaea488/86d6277f9e2f0708d5a7078dea24b899a801f299.jpg",
			"http://a.hiphotos.baidu.com/image/w%3D230/sign=1c4de27ee9f81a4c2632ebcae72b6029/77094b36acaf2eddb3b219e38f1001e93901937c.jpg",
			"http://b.hiphotos.baidu.com/image/pic/item/d53f8794a4c27d1ef3cea1cd19d5ad6edcc438ca.jpg",
			"http://f.hiphotos.baidu.com/image/pic/item/242dd42a2834349be6ac35f4c8ea15ce36d3be1d.jpg",
			"http://e.hiphotos.baidu.com/image/w%3D230/sign=16c5133e938fa0ec7fc7630e1697594a/c8ea15ce36d3d539c215dece3887e950352ab097.jpg",
			"http://d.hiphotos.baidu.com/image/pic/item/a50f4bfbfbedab64b8be4fb5f536afc378311ef2.jpg",
			"http://h.hiphotos.baidu.com/image/w%3D2048/sign=329ab5722a34349b74066985fdd214ce/2fdda3cc7cd98d10165e5859233fb80e7aec90cb.jpg",
			"http://g.hiphotos.baidu.com/image/w%3D2048/sign=ec18c55749fbfbeddc59317f4cc8f636/267f9e2f07082838a987887cba99a9014d08f1d4.jpg",
			"http://d.hiphotos.baidu.com/image/w%3D2048/sign=bc0a7773ba99a9013b355c3629ad0b7b/0df3d7ca7bcb0a465125205e6963f6246b60af56.jpg",
			"http://e.hiphotos.baidu.com/image/w%3D2048/sign=37b2e85e4936acaf59e091fc48e18c10/9825bc315c6034a8a28213e6c913495409237671.jpg",
			"http://e.hiphotos.baidu.com/image/w%3D2048/sign=c760c5bbd358ccbf1bbcb23a2de0bd3e/fd039245d688d43ff32afdfb7f1ed21b0ef43b33.jpg",
			"http://b.hiphotos.baidu.com/image/w%3D2048/sign=098f6da2013b5bb5bed727fe02ebd439/7dd98d1001e939010084e13779ec54e736d19630.jpg",
			"http://a.hiphotos.baidu.com/image/w%3D2048/sign=708e6d46a918972ba33a07cad2f57a89/b8014a90f603738d09ef5d70b11bb051f819ec3f.jpg",
			"http://f.hiphotos.baidu.com/image/w%3D2048/sign=8f3dad8b552c11dfded1b823571f63d0/eaf81a4c510fd9f93ace3f01272dd42a2934a4f9.jpg" };

	// 得到下一组图片
	public static List<String> getNextPageList() {
		List<String> result = new ArrayList<String>();
		for(int i = 0; i < PAGE_SIZE; i++) {
			result.add(imageUrls[index]);
			index = (index + 1) % imageUrls.length;
		}
		return result;
	}

	// 得到任意position对应的图片url
	public static String getPositionedImage(int position) {
		return imageUrls[position % imageUrls.length];
	}
}